﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using compshop.Infrastructure;
using compshop.Infrastructure.CompShopDataService;
namespace compshop.Modules.ListOfWaybills.Presenter
{
  public  class WaybillListPresenter
    {
        private CompShopEntities compShopDataContext;
        private EventsManager eventsManager;

        public IViewWaybillList View { set; get; }
        public List<Waybill> WaybillsList { set; get; }
        public List<Department> DepartmentList { set; get; }
        public List<Employee> EmployeeList { set; get; }

        public WaybillListPresenter( EventsManager eventsManager)
        {
            compShopDataContext= CompShopEntitiesContext.GetInstance();
            WaybillsList = compShopDataContext.Waybills.ToList();
            EmployeeList = compShopDataContext.Employees.ToList();
            DepartmentList = compShopDataContext.Departments.ToList();
            this.eventsManager = eventsManager;
            eventsManager.Presenter = this;
            eventsManager.Subscribe();
            
        }       

       #region Publishers

        public void WayBillSelectedPublisher(int id)
        {
            eventsManager.eventAggregator.GetEvent<WayBillSelectedEvent>().Publish(id);
        }
       #endregion

       #region Handlers


       #endregion

    }
}
